import layoutHeaderAside from '@/layout/header-aside'

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
const _import = require('@/libs/util.import.' + process.env.NODE_ENV)

/**
 * 在主框架内显示
 */
const frameIn = [
  {
    path: '/',
    redirect: { name: 'index' },
    component: layoutHeaderAside,
    children: [
      // 首页
      {
        path: 'index',
        name: 'index',
        meta: {
          auth: true
        },
        component: _import('system/index')
      },
      // 系统 前端日志
      {
        path: 'log',
        name: 'log',
        meta: {
          title: '前端日志',
          auth: true
        },
        component: _import('system/log')
      },
      // 刷新页面 必须保留
      {
        path: 'refresh',
        name: 'refresh',
        hidden: true,
        component: _import('system/function/refresh')
      },
      // 页面重定向 必须保留
      {
        path: 'redirect/:route*',
        name: 'redirect',
        hidden: false,
        component: _import('system/function/redirect')
      },



      // 自定义页面
      {
        path: "/userinfo",
        name: "userinfo",
        component: _import("userInfo/userInfo.vue"),
        meta: {
          auth: true,
          title: "我的信息"
        }
      },
      {
        path: "/info",
        name: "info",
        component: _import("info/index.vue"),
        meta: {
          auth: true,
          title: "数据面板"
        }
      },
      {
        path: "/userAdmin",
        name: "userAdmin",
        component: _import("userAdmin/index.vue"),
        meta: {
          auth: true,
          title: "用户列表"
        }
      },
      {
        path: "/userAdmin/area",
        name: "userAdmin-area",
        component: _import("userAdmin/area.vue"),
        meta: {
          auth: true,
          title: "经纪人审核"
        }
      },
      {
        path: "/userAdmin/audit",
        name: "userAdmin-audit",
        component: _import("userAdmin/audit.vue"),
        meta: {
          auth: true,
          title: "房东审核"
        }
      },
      {
        path: "/garden",
        name: "garden",
        component: _import("garden/index.vue"),
        meta: {
          auth: true,
          title: "园区管理"
        }
      },
      {
        path: "/garden/add",
        name: "garden-add",
        component: _import("garden/add.vue"),
        meta: {
          auth: true,
          title: "新增园区"
        }
      },
      {
        path: "/garden/edit/:id",
        name: "garden-edit",
        component: _import("garden/edit.vue"),
        meta: {
          auth: true,
          title: "编辑园区"
        }
      },
      {
        path: "/house",
        name: "house",
        component: _import("house/index.vue"),
        meta: {
          auth: true,
          title: "房产管理"
        }
      },
      {
        path: "/house/add",
        name: "house-add",
        component: _import("house/houseAdd.vue"),
        meta: {
          auth: true,
          title: "新增房产"
        }
      },
      {
        path: "/house/edit/:id",
        name: "house-edit",
        component: _import("house/houseEdit.vue"),
        meta: {
          auth: true,
          title: "房产详情/编辑"
        }
      },
      {
        path: "/house/audit",
        name: "house-audit",
        component: _import("house/audit.vue"),
        meta: {
          auth: true,
          title: "房产审核"
        }
      },
      {
        path: "/house/auditDetail/:id",
        name: "house-auditDetail",
        component: _import("house/auditDetail.vue"),
        meta: {
          auth: true,
          title: "房产审核详情"
        }
      },
      {
        path: "/housing",
        name: "housing",
        component: _import("housing_resource/index.vue"),
        meta: {
          auth: true,
          title: "房源管理"
        }
      },
      {
        path: "/housing/add",
        name: "housing-add",
        component: _import("housing_resource/add.vue"),
        meta: {
          auth: true,
          title: "新增房源"
        }
      },
      {
        path: "/housing/edit/:id",
        name: "housing-edit",
        component: _import("housing_resource/edit.vue"),
        meta: {
          auth: true,
          title: "编辑房源"
        }
      },
      {
        path: "/company",
        name: "company",
        component: _import("company/index.vue"),
        meta: {
          auth: true,
          title: "企业管理"
        }
      },
      {
        path: "/company/add",
        name: "company-add",
        component: _import("company/add.vue"),
        meta: {
          auth: true,
          title: "新增企业"
        }
      },
      {
        path: "/company/edit/:id",
        name: "company-edit",
        component: _import("company/edit.vue"),
        meta: {
          auth: true,
          title: "企业详情"
        }
      },
      {
        path: "/report",
        name: "report",
        component: _import("report/index.vue"),
        meta: {
          auth: true,
          title: "报备管理"
        }
      },
      {
        path: "/report/detail/:id",
        name: "report-detail",
        component: _import("report/detail.vue"),
        meta: {
          auth: true,
          title: "报备管理"
        }
      },
      {
        path: "/contract",
        name: "contract",
        component: _import("contract/index.vue"),
        meta: {
          auth: true,
          title: "合同管理"
        }
      },
      {
        path: "/contract/add",
        name: "contract-add",
        component: _import("contract/add.vue"),
        meta: {
          auth: true,
          title: "新增合同"
        }
      },
      {
        path: "/contract/edit/:id",
        name: "contract-edit",
        component: _import("contract/edit.vue"),
        meta: {
          auth: true,
          title: "编辑合同"
        }
      },
      {
        path: "/commission",
        name: "commission",
        component: _import("commission/index.vue"),
        meta: {
          auth: true,
          title: "佣金发放管理"
        }
      },
      {
        path: "/withdraw",
        name: "withdraw",
        component: _import("withdraw/index.vue"),
        meta: {
          auth: true,
          title: "提现管理"
        }
      },
      {
        path: "/operation",
        name: "operation",
        component: _import("operation/index.vue"),
        meta: {
          auth: true,
          title: "展示管理"
        }
      },
      {
        path: "/banner/add",
        name: "banner-add",
        component: _import("operation/addBanner.vue"),
        meta: {
          auth: true,
          title: "新增Banner"
        }
      },
      {
        path: "/banner/edit/:id",
        name: "banner-edit",
        component: _import("operation/editBanner.vue"),
        meta: {
          auth: true,
          title: "编辑Banner"
        }
      },
      {
        path: "/service",
        name: "service",
        component: _import("operation/service.vue"),
        meta: {
          auth: true,
          title: "客服管理"
        }
      },
      {
        path: "/runset",
        name: "runset",
        component: _import("operation/runSet.vue"),
        meta: {
          auth: true,
          title: "运营配置"
        }
      },
      {
        path: "/systemAdmin",
        name: "systemAdmin",
        component: _import("system_admin/userAdmin.vue"),
        meta: {
          auth: true,
          title: "员工管理"
        }
      },
      {
        path: "/systemAdmin/add",
        name: "systemAdmin-add",
        component: _import("system_admin/userAdd.vue"),
        meta: {
          auth: true,
          title: "新增员工"
        }
      },
      {
        path: "/systemAdmin/edit/:id",
        name: "systemAdmin-edit",
        component: _import("system_admin/userEdit.vue"),
        meta: {
          auth: true,
          title: "编辑员工"
        }
      },
      {
        path: "/systemAdmin/role",
        name: "systemAdmin-role",
        component: _import("system_admin/roleAdmin.vue"),
        meta: {
          auth: true,
          title: "角色管理"
        }
      },
      {
        path: "/systemAdmin/role/add",
        name: "systemAdmin-role-add",
        component: _import("system_admin/roleAdd.vue"),
        meta: {
          auth: true,
          title: "新增角色"
        }
      },
      {
        path: "/systemAdmin/roletree/edit/:id",
        name: "systemAdmin-role-tree-edit",
        component: _import("system_admin/roleTreeEdit.vue"),
        meta: {
          auth: true,
          title: "编辑角色权限"
        }
      },
      {
        path: "/systemAdmin/role/edit/:id",
        name: "systemAdmin-role-edit",
        component: _import("system_admin/roleEdit.vue"),
        meta: {
          auth: true,
          title: "编辑角色"
        }
      },
      {
        path: "/systemAdmin/logs",
        name: "systemAdmin-logs",
        component: _import("system_admin/logsAdmin.vue"),
        meta: {
          auth: true,
          title: "日志管理"
        }
      },
      {
        path: "/ranking/list",
        name: "ranking-list",
        component: _import("ranking_list/index.vue"),
        meta: {
          auth: true,
          title: "排行榜"
        }
      },
    ]
  }
]

/**
 * 在主框架之外显示
 */
const frameOut = [
  // 登录
  {
    path: '/login',
    name: 'login',
    component: _import('system/login')
  }
]

/**
 * 错误页面
 */
const errorPage = [
  {
    path: '*',
    name: '404',
    component: _import('system/error/404')
  }
]

// 导出需要显示菜单的
export const frameInRoutes = frameIn

// 重新组织后导出
export default [
  ...frameIn,
  ...frameOut,
  ...errorPage
]
